﻿<UserControl x:Class="Twilight.Views.DefaultView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:controls="clr-namespace:Twilight.Controls"
    xmlns:v="clr-namespace:Twilight.Views"
    xmlns:vm="clr-namespace:Twilight.ViewModels"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:vsm="clr-namespace:System.Windows;assembly=System.Windows"
    mc:Ignorable="d"
    d:DesignWidth="200" d:DesignHeight="400">
    <UserControl.Resources>
        <vm:ListViewModel x:Key="tweetData" d:IsDataSource="True" />
    </UserControl.Resources>
    <Border BorderThickness="1" BorderBrush="Black" CornerRadius="2">
        <vsm:VisualStateManager.VisualStateGroups>
            <vsm:VisualStateGroup x:Name="LoadStates">
                <vsm:VisualState x:Name="Loading" />
                <vsm:VisualState x:Name="Loaded">
                    <Storyboard>
                        <DoubleAnimation Storyboard.TargetName="loading"
                                         Storyboard.TargetProperty="Opacity"
                                         To="0" Duration="0:0:0.25"/>
                    </Storyboard>
                </vsm:VisualState>
            </vsm:VisualStateGroup>
        </vsm:VisualStateManager.VisualStateGroups>
        <Grid x:Name="LayoutRoot" DataContext="{Binding Mode=OneWay, Source={StaticResource tweetData}}">
            <Grid.RowDefinitions>
                <RowDefinition Height="24" />
                <RowDefinition Height="*" />
                <RowDefinition Height="20" />
            </Grid.RowDefinitions>
            <Grid.Background>
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                    <GradientStop Color="#FFB1CCFF"/>
                    <GradientStop Color="#FF3057A5" Offset="1"/>
                </LinearGradientBrush>
            </Grid.Background>
            <Image HorizontalAlignment="Left" Grid.Row="0" Margin="2" Source="http://assets1.twitter.com/images/twitter_logo_s.png" Height="20" Stretch="Uniform" />
            <ListBox Grid.Row="1" x:Name="twitList" ItemsSource="{Binding Tweets}" ItemContainerStyle='{StaticResource FeedItemContainerStyle}' Template="{StaticResource FeedListBox}" />
            <TextBlock Grid.Row="1" x:Name="loading" HorizontalAlignment="Center" VerticalAlignment="Center" Text="Loading..." />
            <HyperlinkButton HorizontalAlignment="Right" Grid.Row="2" x:Name="followLink" Content="follow me on Twitter" Margin="5,0,19,0" NavigateUri="{Binding FollowUri}"/>
        </Grid>
    </Border>
</UserControl>
